home *** CD-ROM | disk | FTP | other *** search
Wrap
XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) NNNNAAAAMMMMEEEE XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll - a shell widget class used for printing in Motif SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS #include <Xm/Print.h> BBBBoooooooolllleeeeaaaannnn XXXXmmmmIIIIssssPPPPrrrriiiinnnnttttSSSShhhheeeellllllll( WWWWiiiiddddggggeeeetttt); VVVVEEEERRRRSSSSIIIIOOOONNNN This page documents Motif 2.1. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN The XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllllprovides the Motif application programmer with an Xt widget oriented API to some of the X Print resources and a callback to drive the pagination. The XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllllprovides a simple callback to handle the pagination logic, and a set of resources to get and set common printer attributes. If not created on an XXXXPPPPrrrriiiinnnnttttconnection, XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllllbehaves as a regular applicationShell. The XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllllalso initializes the XXXXpppp extension event handling mechanism, by registering an extension selector that calls XXXXppppSSSSeeeelllleeeeccccttttIIIInnnnppppuuuuttttand event dispatcher for print and attributes XXXXpppp events, so applications can use XXXXttttIIIInnnnsssseeeerrrrttttEEEEvvvveeeennnnttttTTTTyyyyppppeeeeHHHHaaaannnnddddlllleeeerrrrto register their own handler with the XXXXpppp events. AAAArrrrgggguuuummmmeeeennnnttttssss No XXXXmmmmCCCCrrrreeeeaaaatttteeee function is provided, since this is a toplevel shell, most likely created thru some XXXXttttshell creation routine or XXXXmmmmPPPPrrrriiiinnnnttttSSSSeeeettttuuuupppp. CCCCllllaaaasssssssseeeessss XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll is a subclass of AAAApppppppplllliiiiccccaaaattttiiiioooonnnnSSSShhhheeeellllllll; it inherits behavior, resources and traits from all its superclasses. The class pointer is _X_m_P_r_i_n_t_S_h_e_l_l_W_i_d_g_e_t_C_l_a_s_s. NNNNeeeewwww RRRReeeessssoooouuuurrrrcccceeeessss XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll RRRReeeessssoooouuuurrrrcccceeee SSSSeeeetttt NNNNaaaammmmeeee CCCCllllaaaassssssss TTTTyyyyppppeeee DDDDeeeeffffaaaauuuulllltttt AAAAcccccccceeeessssssss _X_m_N_s_t_a_r_t_J_o_b_C_a_l_l_b_a_c_k _X_m_C_C_a_l_l_b_a_c_k _X_t_C_a_l_l_b_a_c_k_L_i_s_t _N_U_L_L CCCCSSSSGGGG _X_m_N_e_n_d_J_o_b_C_a_l_l_b_a_c_k _X_m_C_C_a_l_l_b_a_c_k _X_t_C_a_l_l_b_a_c_k_L_i_s_t _N_U_L_L CCCCSSSSGGGG _X_m_N_p_a_g_e_S_e_t_u_p_C_a_l_l_b_a_c_k _X_m_C_C_a_l_l_b_a_c_k _X_t_C_a_l_l_b_a_c_k_L_i_s_t _N_U_L_L CCCCSSSSGGGG _X_m_N_m_i_n_X _X_m_C_M_i_n_X DDDDiiiimmmmeeeennnnssssiiiioooonnnn ddddyyyynnnnaaaammmmiiiicccc GGGG _X_m_N_m_i_n_Y _X_m_C_M_i_n_Y DDDDiiiimmmmeeeennnnssssiiiioooonnnn ddddyyyynnnnaaaammmmiiiicccc GGGG _X_m_N_m_a_x_X _X_m_C_M_a_x_X DDDDiiiimmmmeeeennnnssssiiiioooonnnn ddddyyyynnnnaaaammmmiiiicccc GGGG Page 1 (printed 10/3/02) XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) _X_m_N_m_a_x_Y _X_m_C_M_a_x_Y DDDDiiiimmmmeeeennnnssssiiiioooonnnn ddddyyyynnnnaaaammmmiiiicccc GGGG _X_m_N_d_e_f_a_u_l_t_P_i_x_m_a_p_R_e_s_o_l_u_t_i_o_n _X_m_C_D_e_f_a_u_l_t_P_i_x_m_a_p_R_e_s_o_l_u_t_i_o_n uuuunnnnssssiiiiggggnnnneeeedddd sssshhhhoooorrrrtttt 111100000000 CCCCSSSSGGGG _X_m_N_p_d_m_N_o_t_i_f_i_c_a_t_i_o_n_C_a_l_l_b_a_c_k _X_m_C_C_a_l_l_b_a_c_k _X_t_C_a_l_l_b_a_c_k_L_i_s_t _N_U_L_L CCCCSSSSGGGG _X_m_N_s_t_a_r_t_J_o_b_C_a_l_l_b_a_c_k Specifies the callback driving the beginning of rendering. It is safe for an application to start rendering after this callback has been activated. XXXXppppSSSSttttaaaarrrrttttJJJJoooobbbbmust be called to trigger this callback. _X_m_N_e_n_d_J_o_b_C_a_l_l_b_a_c_k Specifies the callback driving the end of rendering. Notify the client that all rendering has been processed (whether on print-to-file or regular spool). XXXXppppEEEEnnnnddddJJJJoooobbbbis called by the print shell to trigger this callback. _X_m_N_p_a_g_e_S_e_t_u_p_C_a_l_l_b_a_c_k Specifies the callback driving the page layout. It is safe for an app to start rendering from this callback even if the XXXXmmmmNNNNssssttttaaaarrrrttttJJJJoooobbbbCCCCaaaallllllllbbbbaaaacccckkkkis not used. _X_m_N_m_i_n_X, _X_m_N_m_i_n_Y, _X_m_N_m_a_x_X, _X_m_N_m_a_x_Y Specify the imageable area of the page in the current print context. XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll also maintains a proper size at all times by updating its own widget dimension whenever an attribute, such as resolution or orientation, changes. It is sized in its IIIInnnniiiittttiiiiaaaalllliiiizzzzeeee routine so that the application can rely on a proper size before the first SSSSttttaaaarrrrttttPPPPaaaaggggeeee call is issued. _X_m_N_d_e_f_a_u_l_t_P_i_x_m_a_p_R_e_s_o_l_u_t_i_o_n Indicates the resolution in dpi (dot per inch) of the image files read and converted by Motif for the widget descendants of this shell. It is used to determine a scaling ratio to be applied to pixmap created thru regular pixmap/icon conversion of the following Widget resources: +o _X_m_L_a_b_e_l.label*Pixmap, _X_m_I_c_o_n_G.*IconPixmap _X_m_T_o_g_g_l_e_B.selectPixmap, _X_m_P_u_s_h_B_G.armPixmap, _X_m_I_c_o_n_G.*IconMask, _X_m_M_e_s_s_a_g_e_B_o_x.symbolPixmap, _X_m_C_o_n_t_a_i_n_e_r.*StatePixmap, ... +o Leaving out the pixmap resources being used for tiling (XmNhighlightPixmap, XmNtopShadowPixmap, XmNbottomShadowPixmap, XmNbackgroundPixmap, ...) Page 2 (printed 10/3/02) XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) _X_m_N_p_d_m_N_o_t_i_f_i_c_a_t_i_o_n_C_a_l_l_b_a_c_k A callback notifying the application about the status of the PDM (see XmPrintPopupPDM). A XmPrintShellCallbackStruct is used, with reason: +o _X_m_C_R__P_D_M__N_O_N_E: no PDM available on this display for the named selection (provided in detail) +o _X_m_C_R__P_D_M__S_T_A_R_T__V_X_A_U_T_H: the PDM is not authorized to connect to the video display. +o _X_m_C_R__P_D_M__S_T_A_R_T__P_X_A_U_T_H: the PDM is not authorized to connect to the print display. +o _X_m_C_R__P_D_M__U_P: the PDM is up and running +o _X_m_C_R__P_D_M__O_K: the PDM has exited with OK status +o _X_m_C_R__P_D_M__C_A_N_C_E_L: the PDM has exited with CANCEL +o _X_m_C_R__P_D_M__S_T_A_R_T__E_R_R_O_R: the PDM cannot start due to some error (usually logged) +o _X_m_C_R__P_D_M__E_X_I_T__E_R_R_O_R: the PDM has exited with an error CCCCaaaallllllllbbbbaaaacccckkkk IIIInnnnffffoooorrrrmmmmaaaattttiiiioooonnnn The XXXXmmmmNNNNssssttttaaaarrrrttttJJJJoooobbbbCCCCaaaallllllllbbbbaaaacccckkkk, XXXXmmmmNNNNeeeennnnddddJJJJoooobbbbCCCCaaaallllllllbbbbaaaacccckkkk,,,,XXXXmmmmNNNNppppaaaaggggeeeeSSSSeeeettttuuuuppppCCCCaaaallllllllbbbbaaaacccckkkk and XXXXmmmmNNNNppppddddmmmmNNNNoooottttiiiiffffiiiiccccaaaattttiiiioooonnnnCCCCaaaallllllllbbbbaaaacccckkkkoperate on a _X_m_P_r_i_n_t_S_h_e_l_l_C_a_l_l_b_a_c_k_S_t_r_u_c_t, which is defined as follow: typedef struct { int reason; /* XmCR_START_JOB, XmCR_END_JOB, XmCR_PAGE_SETUP, XmCR_PDM_* */ XEvent *event; XPContext print_context; Boolean last_page; /* in_out */ XtPointer detail; } XmPrintShellCallbackStruct; AAAAddddddddiiiittttiiiioooonnnnaaaallll BBBBeeeehhhhaaaavvvviiiioooorrrr The _l_a_s_t__p_a_g_e field is only meaningful when the reason is _X_m_C_R__P_A_G_E__S_E_T_U_P. The page setup callback is called with _l_a_s_t__p_a_g_e FFFFaaaallllsssseeee to notify the application that it has to get its internal layout state ready for the next page. Typically, a widget Page 3 (printed 10/3/02) XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) based application will change the content of a LLLLaaaabbbbeeeellll showing the page number, or scroll the content of the TTTTeeeexxxxtttt widget. When the application has processed its last page, it should set the _l_a_s_t__p_a_g_e field in the callback struct to TTTTrrrruuuueeee. The callback will be called a last time after that with _l_a_s_t__p_a_g_eFFFFaaaallllsssseeee to notify the application that it can safely clean-up its internal state (e.g., destroy widgets). No drawing should occur from within the callback function in the application, this is an Exposure event-driven programming model where widgets render themselves from their expose methods. The print shell calls XXXXppppSSSSttttaaaarrrrttttPPPPaaaaggggeeee after the ppppaaaaggggeeeeSSSSeeeettttuuuuppppCCCCaaaallllllllbbbbaaaacccckkkk returns, and XXXXppppEEEEnnnnddddPPPPaaaaggggeeeeupon reception of SSSSttttaaaarrrrttttPPPPaaaaggggeeeeNNNNoooottttiiiiffffyyyy. EEEERRRRRRRROOOORRRRSSSS////WWWWAAAARRRRNNNNIIIINNNNGGGGSSSS _X_m_P_r_i_n_t_S_h_e_l_l can generate the following warnings: +o NNNNooootttt ccccoooonnnnnnnneeeecccctttteeeedddd ttttoooo aaaa vvvvaaaalllliiiidddd XXXX PPPPrrrriiiinnnntttt SSSSeeeerrrrvvvveeeerrrr:::: bbbbeeeehhhhaaaavvvviiiioooorrrr uuuunnnnddddeeeeffffiiiinnnneeeedddd.... +o AAAAtttttttteeeemmmmpppptttt ttttoooo sssseeeetttt aaaannnn iiiinnnnvvvvaaaalllliiiidddd rrrreeeessssoooolllluuuuttttiiiioooonnnn oooonnnn aaaa pppprrrriiiinnnntttteeeerrrr:::: %%%%ssss +o AAAAtttttttteeeemmmmpppptttt ttttoooo sssseeeetttt aaaannnn iiiinnnnvvvvaaaalllliiiidddd oooorrrriiiieeeennnnttttaaaattttiiiioooonnnn oooonnnn aaaa pppprrrriiiinnnntttteeeerrrr:::: %%%%ssss RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE Not applicable EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS PrintOnePageCB(Widget pshell, XtPointer npages, /*----------*/ XmPrintSetPageCBStruct psp) { static int cur_page = 0; cur_page++; if (! psp->last_page && curPage > 1) /* no need to scroll for the first page */ { XmTextScroll(ptext, prows); /* get ready for next page */ } else { /**** I'm done */ XtDestroyWidget(pshell); XtCloseDisplay(XtDisplay(pshell)); } if (cur_page == (int) n_pages) psp->last_page = True; } Page 4 (printed 10/3/02) XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) PrintOKCallback(...) /*-------------*/ { pshell = XmPrintSetup (widget, pbs->print_screen, "Print", NULL, 0); XpStartJob(XtDisplay(pshell), XPSpool); /**** here I get the size of the shell, create my widget hierarchy: a bulleting board, and then a text widget, that I stuff with the video text widget buffer */ /* get the total number of pages to print */ /* same code as previous example to get n_pages */ /**** set up my print callback */ XtAddCallback(pshell, XmNpageSetUpCallback, PrintOnePageCB, n_pages); } Examples of XXXXmmmmNNNNddddeeeeffffaaaauuuullllttttPPPPiiiixxxxmmmmaaaappppRRRReeeessssoooolllluuuuttttiiiioooonnnn usage: +o An application reuses the same image sources it uses for the video interface, in XBM or XPM, to layout on its printed pages. In this case, scaling is seamless. ! icon.xpm is 30x30 pixels app*dialog.pushb.labelPixmap:icon.xpm ! print is 400dpi app.print*form.lab.labelPixmap:icon.xpm ! 120x120 pixels on the paper (auto scaling) +o An application provides a new set of image files, for a given printer resolution (say 300). It doesn't want automatic scaling by the toolkit for that resolution, it wants scaling based on these 300dpi images for higher resolution. It creates its print shell inside using the name "printHiRes" and adds the following in its resource file: app.printHiRes.defaultPixmapResolution:300 ! icon300.xpm is 120x120 pixels app.printHiRes*form.lab.labelPixmap:icon300.xpm ! 120x120 pixels on the paper (no scaling) This way a printer resolution of 600 will result in a scale of a 300 dpi image by 2 (dpi=600 divided by base=300), while a printer resolution of 150 (using default print shell name "print") will use the 100 dpi icon scaled by 1.5 (dpi=150 divided by default base=100). SSSSEEEEEEEE AAAALLLLSSSSOOOO PPPPaaaaggggeeee 5555 ((((pppprrrriiiinnnntttteeeedddd 11110000////3333////00002222)))) XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll((((3333XXXX)))) XXXXmmmmPPPPrrrriiiinnnnttttSSSSeeeettttuuuupppp(3), XXXXmmmmRRRReeeeddddiiiissssppppllllaaaayyyyWWWWiiiiddddggggeeeetttt(3), XXXXmmmmPPPPrrrriiiinnnnttttTTTTooooFFFFiiiilllleeee(3), XXXXmmmmPPPPrrrriiiinnnnttttPPPPooooppppuuuuppppPPPPDDDDMMMM(3) Page 6 (printed 10/3/02)